package cn.iocoder.yudao.module.erp.dal.mysql.stocksmove;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.stocksmove.StocksMoveDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.erp.controller.admin.stocksmove.vo.*;

/**
 * ERP 库存调拨单 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface StocksMoveMapper extends BaseMapperX<StocksMoveDO> {

    default PageResult<StocksMoveDO> selectPage(StocksMovePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StocksMoveDO>()
                .eqIfPresent(StocksMoveDO::getNo, reqVO.getNo())
                .eqIfPresent(StocksMoveDO::getFromWarehouseId, reqVO.getFromWarehouseId())
                .eqIfPresent(StocksMoveDO::getToWarehouseId, reqVO.getToWarehouseId())
                .betweenIfPresent(StocksMoveDO::getMoveTime, reqVO.getMoveTime())
                .eqIfPresent(StocksMoveDO::getRemark, reqVO.getRemark())
                .eqIfPresent(StocksMoveDO::getStatus, reqVO.getStatus())
                .eqIfPresent(StocksMoveDO::getProcessInstanceId, reqVO.getProcessInstanceId())
                .betweenIfPresent(StocksMoveDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StocksMoveDO::getId));
    }

}